﻿@{
    //Layout = "~/Views/Shared/_Form.cshtml";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
}
<script>
    var options = {
        TypeId: request('TypeId'),//巡检专业
        ItemId: request('ItemId'),//巡检项目
        ObjectId: request('ObjectId'),//巡检点
        OrganizeId: request('OrganizeId'),
        Category: request('Category'),//看板类型
        StartTime: request('StartTime'),//看板开始时间
        DateAdd: request('DateAdd'),//看板纵坐标
    };

    $(function () {

        InitialPage();
        GetGrid();
    })
    function InitialPage() {
        //resize重设(表格、树形)宽高
        $(window).resize(function (e) {
            window.setTimeout(function () {
                $('#gridTable').setGridWidth(($('.gridPanel').width() * 0.6));
                $("#gridTable").setGridHeight($(window).height() - 175.5);
            }, 200);
            e.stopPropagation();
        });
        $("#Type").text("保洁巡检:");
        if (options.ItemId == "") $("#Frequency").attr("hidden", "hidden").prev().attr("hidden", "hidden");

    }
    //加载表格
    function GetGrid() {
        var selectedRowIndex = 0;
        var $gridTable = $('#gridTable');
        $gridTable.jqGrid({
            url: "../../PropertyManage/CS_PollingResult/GetResultList",
            postData: { queryJson: JSON.stringify(options) },
            datatype: "json",
            height: $(window).height() - 175.5,
            autowidth: true,
            colModel: [
                { label: "主键", name: "Id", index: "Id", hidden: true },
                { label: "项目主键", name: "Icode", index: "Icode", hidden: true },
                { label: "巡检人", name: "CreateUserName", index: "CreateUserName", width: 100, align: "center" },
                { label: "巡检专业", name: "Bname", index: "Bname", width: 100, align: "center" },
                { label: "项目名称", name: "Iname", index: "Iname", width: 100, align: "center" },
                { label: "巡检时间", name: "Date", index: "Date", width: 150, align: "center" },
            ],
            viewrecords: true,
            rowNum: 100,
            rowList: [100, 200, 300],
            pager: "#gridPager",
            sortname: 'Date',
            sortorder: 'desc',
            rownumbers: true,
            shrinkToFit: false,
            gridview: true,
            onSelectRow: function (rowid) {
                if (selectedRowIndex != $("#" + this.id).getGridParam('selrow')) {
                    selectedRowIndex = $("#" + this.id).getGridParam('selrow');
                    Detail(rowid);
                }
            },
            gridComplete: function () {
                $("#" + this.id).setSelection(selectedRowIndex, false);
            }
        });
    }
    function Detail(rowid) {
        $("#Detail").html("");
        $("#DetailDiv").html("");
        var obj = $("#gridTable").jqGrid('getRowData', rowid);
        $.ajax({
            type: "GET",
            dataType: "text",
            data: { ResultId: obj.Id, itemId: obj.Icode },
            url: "../../PropertyManage/CS_PollingResult/GetResultDetail",
            success: function (data) {
                data = JSON.parse(data);
                $("#Detail").append(data.Html);
                $("#DetailDiv").append(data.FileHtml);
            }
        });
    }
</script>
<div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
    <div class="ui-layout-center">
        <div class="center-Panel">
            <div class="panel-Title">巡检明细</div>
            <div class="titlePanel">
                <div class="title-search">
                    <table id="queryCondition">
                        <tr style="padding-left: 10px;" hidden>
                            <td id="Type"></td>     <!--巡检专业-->
                            <td id="Item"></td>     <!--巡检项目-->
                            <td style="text-align: center; padding-left: 20px;">巡检对象：</td>
                            <td id="ObjectName"></td>
                            <td style="padding-left: 20px;">频次标准：</td>
                            <td id="Frequency"></td>
                            <td style="padding-left: 20px;">巡检时间:</td>
                            <td id="Date"></td>
                        </tr>
                    </table>
                </div>
                <div class="toolbar">
                    <div class="btn-group">
                        <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
                    </div>
                </div>
                @*<script>$('.toolbar').authorizeButton()</script>*@
            </div>
            <div class="gridPanel" style="width: 100%; border-top: 1px solid #CCC;">
                <table style="width:100%;">
                    <tr style="width:100%;">
                        <td style="width:60%;padding-top:10px;border-right:1px solid #CCC;" valign="top">
                            <table id="gridTable"></table>
                            <div id="gridPager"></div>
                        </td>
                        <td style="width: 40%; position: relative; height: 100%; padding-bottom: 120px;" valign="top">
                            <div style="height: 623px; overflow: auto;"><table class="table" id="Detail"></table></div>
                            <div id="DetailDiv" style="height: 120px; width: 100%; border-top: 1px dashed #ccc; position: absolute; bottom: 0px; ">
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>

